<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;
//前台默认控制器
class IndexController extends Controller{

    //首页
    public function index(){
    	
//		获得标签名
		$tagModel = new \Common\Model\Tag;
//		p($tagData);
		
		$arcTagModel = new \Common\Model\ArcTag;
////  	获得最新的文章
		$arcModel = new \Common\Model\Arc;
		
		$arcData = $arcModel
				->join('category','category_cid','=','cid')
				->where("is_recycle=0")
				->orderBy('sendtime','DESC')
				->get();
		foreach ($arcData as $key => $value) {
			$arcData[$key]['tag']= $arcTagModel
//									关联便签表跟文章表
									->join('tag','tid','=','tag_tid')
//									文章跟中间表
									->where("article_aid={$value['aid']}")
									->get();
		}
//		p($arcData);
		View::with('arcData',$arcData);
		View::make();
    }
}	